<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div>
    <p>asas</p>
    <input type="text">
</div>
<div>
    <div>
        <p>saa</p>
        <span>as</span>
        <li>asa</li>
        <li>sas</li>sd
    </div>
</div>
</body>
<script>
const arr=document.getElementsByTagName('*')
const obj={}
Array.from(arr).forEach(item=>{
  if(obj[item.tagName]){
    obj[item.tagName]+=1
  }else{
    obj[item.tagName]=1
  }
})
console.log(obj)
</script>
</html>
